﻿Imports Entidades
Imports Negocio
Module Module1
    Dim negocio As New Negocio.Negocio
    Dim cartaNula As Carta
    Dim cartasNulas As ObjectModel.ReadOnlyCollection(Of Carta)
    Dim duelistasNulos As ObjectModel.ReadOnlyCollection(Of Duelista)
    
    Public Function obtenerCartaPorId(id As String) As Carta
        Dim carta = negocio.getCardById(id)
        If IsNothing(carta) Then Return cartaNula
        Return carta
    End Function

    Public Function obtenerCartasPorNombre(nombre As String) As ObjectModel.ReadOnlyCollection(Of Carta)
        Dim cartas = negocio.getCardsByName(nombre)
        If cartas.Count < 1 Then Return cartasNulas
        Return cartas
    End Function

    Public Function obtenerDuelistaPorPrestamo(prestamo As Prestamo) As ObjectModel.ReadOnlyCollection(Of Duelista)
        Dim duelistas = negocio.duelistasPorPrestamo(prestamo)
        If duelistas.Count < 1 Then Return duelistasNulos
        Return duelistas
    End Function
End Module

